package org.karelun.gef.outline;

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.karelun.gef.model.ClassModel;
import org.karelun.gef.model.DiagramModel;
import org.karelun.gef.model.Node;

public class TreePartFactory implements EditPartFactory {

	public EditPart createEditPart(EditPart context, Object model) {
		EditPart part = null;
		if (model instanceof DiagramModel) {
			part = new DiagramTreeEditPart(model);
		} else if (model instanceof Node) {
			if (model instanceof ClassModel)
				part = new ClassModelTreeEditPart(model);
			else
				part = new NodeTreeEditPart(model);
		}
		if (part != null)
			part.setModel(model);
		return part;
	}
}
